<template>
	<view class="container">

		<view class="model">
			<view v-if="isShowServeInfo" class="model-info">
				<view class="header">
					<view class="horizontal">
						<view class="line"></view>
						<view class="model-info-title">联系方式</view>
					</view>
					<view class="model-info-close" @click="isShowServeInfo = false">
						<image src="../../static/images/icon/close_icon.png" mode="widthFix"></image>
					</view>
				</view>
				<view class="dividingLine"></view>
				<view class="model-info-list">
					<view class="model-info-item">
						<view class="model-info-item-image">
							<image src="../../static/images/icon/wechat.png" mode="widthFix"></image>
						</view>
						<view class="model-info-item-title">14865978215</view>
					</view>
					<view class="model-info-item">
						<view class="model-info-item-image">
							<image src="../../static/images/icon/phone.png" mode="widthFix"></image>
						</view>
						<view class="model-info-item-title">15948753264</view>
					</view>
					<view class="model-info-item">
						<view class="model-info-item-image">
							<image src="../../static/images/common/hotline.png" mode="widthFix"></image>
						</view>
						<view class="model-info-item-title">400-6369-798</view>
					</view>
				</view>
			</view>
			<view v-else class="float-image" @click="isShowServeInfo=true">
				<image src="../../static/images/common/zixun.png" class="float-image-consult"></image>
			</view>
		</view>

		<view class="index_dialog" v-if="isShowDialog">
			<image class="dialog_banner" src="@/static/images/dialong_banner.png"></image>
			<image @click="isShowDialog = false" class="close_icon" src="@/static/images/close_icon.png"></image>
		</view>
		<swiper class="banner_swiper" autoplay="true">
			<swiper-item>
				<image class="banner_image" src="@/static/images/common/yuyue.png" mode="aspectFill"></image>
			</swiper-item>
			<swiper-item>
				<image class="banner_image" src="@/static/images/common/banner1.png" mode="aspectFill"></image>
			</swiper-item>
			<swiper-item>
				<image class="banner_image" src="@/static/images/common/loupan.png" mode="aspectFill"></image>
			</swiper-item>
		</swiper>
		<view class="model-menu">
			<view class="model-menu-item" @click="goToPage('/pages/index/Real/Real?page=1&limit=10&style=0&area=0&model=0')">
				<image class="model-menu-item-icon" src="../../static/images/icon/loupan_icon.png"></image>
				<view class="model-menu-item-text">热改楼盘</view>
			</view>
			<view class="model-menu-item" @click="goToPage('/pages/index/handbag/handbag')">
				<image class="model-menu-item-icon" src="../../static/images/icon/linbao_icon.png"></image>
				<view class="model-menu-item-text">拎包入住</view>
			</view>
			<view class="model-menu-item" @click="goToPage('/pages/index/site/site')">
				<image class="model-menu-item-icon" src="../../static/images/icon/gongdi_icon.png"></image>
				<view class="model-menu-item-text">工地实景</view>
			</view>
			<view class="model-menu-item">
				<image class="model-menu-item-icon" src="../../static/images/icon/baojie_icon.png"></image>
				<view class="model-menu-item-text">保洁阿姨</view>
			</view>
		</view>

		<view class="list-content">
			<!-- 热改楼盘 -->
			<view class="building-list">
				<view class="building-header">
					<view class="building-header-left">
						<view class="line"></view> 热改楼盘
					</view>
					<view class="building-header-right" @click="goToPage('/pages/index/Real/Real?page=1&limit=10&style=0&area=0&model=0')">
						更多
					</view>
				</view>
				<view class="building-list-content" >
					<view class="building-item-content" @click="goToPage('/pages/index/details/details?id='+item.id)" v-for="(item,index) in buildList" :key="index">
						<image class="building-item-image" mode="aspectFill"
							:src="item.thumb">
						</image>
						<view class="building-item-mark">
							<view class="building-item-title">{{item.name}}</view>
							<view class="building-item-desc">{{item.model.name}}/{{item.style.name}}</view>
						</view>
					</view>
				</view>
			</view>
			<!-- 拎包入住 -->
			<view class="handbag-list" >
				<view class="building-header">
					<view class="building-header-left">
						<view class="line"></view> 拎包入住
					</view>
					<view class="building-header-right" @click="goToPage('/pages/index/handbag/handbag')">
						更多
					</view>
				</view>
				<view class="building-list-content">
					<view class="building-item-content" v-for="(item,index) in comboList" :key="index">
						<image class="building-item-image" mode="aspectFill" :src="item.thumb" @click='goToPage("/pages/index/handbag/handbag?id=" +item.id)'>
						</image>
						<view class="building-item-marked">
							<view class="building-item-title">{{item.name}}</view>
							<view class="building-item-desc">{{item.model}}m²</view>
							<view class="building-item-desc">{{item.desc_str}}</view>
						</view>
					</view>
				</view>
			</view>
			<!-- 工地实景 -->
			<view class="sites-list">
				<view class="building-header">
					<view class="building-header-left">
						<view class="line"></view> 工地实景
					</view>
					<view class="building-header-right" @click="goToPage('/pages/index/site/site')">
						更多
					</view>
				</view>
				<view class="building-list-content">
					<view class="building-item-contents" @click="goToPage('/pages/index/site/liveaction/liveaction?id='+item.id)" v-for='(item,index) in constructionList' :key="index">
						<image class="building-item-images" mode="aspectFit"
							:src="item.thumb">
						</image>
						<view class="building-item-marks">
							<view class="text">{{item.name}}</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: 'Hello',
				isShowDialog: true,
				isShowServeInfo: false,
				buildList:[],
				comboList:[],
				constructionList:[]
			}
		},
		methods: {
			goRequest(){
				this.$http.post("system/getIndexData",{}).then(res=>{
					// console.log(res);
					this.buildList=res.data.data.buildList
					this.comboList=res.data.data.comboList
					this.constructionList=res.data.data.constructionList
				})
			},
			goToPage(path){
				uni.navigateTo({
					url: path
				});
			}
			
		},
		onLoad(){
			this.goRequest()
			this.goToPage()
		}
	}
</script>

<style lang="scss" scoped>
	image {
		width: 100%;
	}

	.horizontal {
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: center;
	}

	.line {
		width: 6rpx;
		height: 28rpx;
		background-color: #3d9c36;
	}

	.dividingLine {
		height: 1rpx;
		background: rgba(0, 0, 0, 0.05);
	}

	.header {
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}

	.container {
		width: 100%;
		height: 100%;

		.index_dialog {
			position: fixed;
			width: 100%;
			height: 100vh;
			background: rgba(0, 0, 0, 0.5);
			z-index: 999;
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;

			.dialog_banner {
				width: 542rpx;
				height: 724rpx;
			}

			.close_icon {
				padding-top: 86rpx;
				width: 80rpx;
				height: 80rpx;
			}
		}

		.model {
			position: fixed;
			bottom: 132rpx;
			right: 20rpx;
			z-index: 999;

			.model-image {
				width: 182rpx;
			}

			.model-info {
				background: rgba(255, 255, 255, 0.8);
				border-radius: 12rpx;
				box-shadow: -4rpx 4rpx 4rpx 0rpx rgba(0, 0, 0, 0.15);
				padding-bottom: 40rpx;

				.header {
					padding: 20rpx;
				}

				.model-info-title {
					margin-left: 20rpx;
				}

				.model-info-close {
					width: 44rpx;
				}

				.model-info-list {
					.model-info-item {
						display: flex;
						padding: 0 46rpx;
						margin-top: 20rpx;

						.model-info-item-image {
							width: 44rpx;
						}

						.model-info-item-title {
							margin-left: 40rpx;
							font-size: 28rpx;
						}
					}
				}

				.model-info-item:first-child {
					margin-top: 32rpx;
				}
			}
		}

		.banner_swiper {
			width: 100%;
			height: 450rpx;

			.banner_image {
				width: 100%;
				height: 100%;
			}
		}

		.model-menu {
			box-sizing: border-box;
			padding: 40rpx 52rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;

			.model-menu-item {
				display: flex;
				flex-direction: column;
				align-items: center;

				.model-menu-item-icon {
					width: 80rpx;
					height: 80rpx;
				}

				.model-menu-item-text {
					font-size: 24rpx;
					font-weight: 500;
					color: #333333;
					margin-top: 8rpx;
					line-height: 24rpx;
				}
			}
		}

		.list-content {
			background: #F5F5F5;

			.building-list {
				background: #ffffff;
				box-sizing: border-box;
				padding-left: 30rpx;
				padding-top: 34rpx;
				padding-bottom: 28rpx;
				position: relative;
				margin-bottom: 40rpx;

				.building-header {
					width: 100%;
					display: flex;
					align-items: center;
					justify-content: space-between;

					.building-header-left {
						font-size: 28rpx;
						font-weight: 700;
						color: #333333;
						line-height: 28rpx;
						display: flex;
						align-items: center;

						.line {
							width: 6rpx;
							height: 28rpx;
							background: #3d9c36;
							margin-right: 20rpx;
						}
					}

					.building-header-right {
						font-size: 24rpx;
						font-weight: 500;
						color: #333333;
						line-height: 24rpx;
					}

					.building-header-right::after {
						content: ">";
						margin-left: 10rpx;
						margin-right: 45rpx;
					}
				}
			}
		}

		.handbag-list {
			background: #ffffff;
			box-sizing: border-box;
			padding-left: 30rpx;
			padding-top: 34rpx;
			padding-bottom: 28rpx;
			margin-top: 40rpx;
			position: relative;

			.building-header {
				width: 100%;
				display: flex;
				align-items: center;
				justify-content: space-between;

				.building-header-left {
					font-size: 28rpx;
					font-weight: 700;
					color: #333333;
					line-height: 28rpx;
					display: flex;
					align-items: center;

					.line {
						width: 6rpx;
						height: 28rpx;
						background: #3d9c36;
						margin-right: 20rpx;
					}
				}

				.building-header-right {
					font-size: 24rpx;
					font-weight: 500;
					color: #333333;
					line-height: 24rpx;
				}

				.building-header-right::after {
					content: ">";
					margin-left: 10rpx;
					margin-right: 45rpx;
				}
			}
		}

		.building-list-content {
			box-sizing: border-box;
			overflow-x: auto;
			overflow-y: hidden;
			margin-top: 20rpx;
			width: 100%;
			display: flex;
			.building-item-content {
				width: 382rpx;
				height: 510rpx;
				margin-right: 40rpx;
				position: relative;

				.building-item-image {
					width: 382rpx;
					height: 510rpx;
					border-radius: 16rpx 16rpx 16rpx 16rpx;
				}

				.building-item-mark {
					position: absolute;
					bottom: 0px;
					left: 0px;
					width: 382rpx;
					height: 94rpx;
					background: rgba(0, 0, 0, .3);
					border-radius: 0rpx 0rpx 16rpx 16rpx;
					box-sizing: border-box;
					padding: 24rpx 12rpx;

					.building-item-title {
						font-size: 24rpx;
						font-weight: 700;
						color: #ffffff;
						line-height: 24rpx;
					}

					.building-item-desc {
						font-size: 20rpx;
						font-weight: 700;
						color: rgba(255, 255, 255, .8);
						line-height: 20rpx;
						margin-top: 20rpx;
					}
				}

				.building-item-marked {
					position: absolute;
					bottom: 0px;
					left: 0px;
					width: 382rpx;
					height: 164rpx;
					background: rgba(0, 0, 0, .3);
					border-radius: 0rpx 0rpx 16rpx 16rpx;
					box-sizing: border-box;
					padding: 24rpx 12rpx;

					.building-item-title {
						font-size: 24rpx;
						font-weight: 700;
						color: #ffffff;
						line-height: 24rpx;
					}

					.building-item-desc {
						font-size: 20rpx;
						font-weight: 700;
						display: flex;
						flex-wrap: wrap;
						color: rgba(255, 255, 255, .8);
						line-height: 25rpx;
						margin-top: 20rpx;
					}
				}
			}

			.building-item-contents {
				width: 520rpx;
				height: 312rpx;
				margin-right: 40rpx;
				position: relative;

				.building-item-images {
					width: 520rpx;
					height: 312rpx;
					border-radius: 0rpx 0rpx 16rpx 16rpx;
				}

				.building-item-marks {
					position: absolute;
					bottom: 0px;
					left: 0px;
					width: 520rpx;
					height: 66rpx;
					background: rgba(0, 0, 0, .3);
					border-radius: 0rpx 0rpx 16rpx 16rpx;

					.text {
						font-size: 24rpx;
						font-weight: 700;
						color: #ffffff;
						line-height: 60rpx;
						margin: 0 auto;
						text-align: center;
					}
				}
			}
		}

		.sites-list {
			background: #ffffff;
			box-sizing: border-box;
			padding-left: 30rpx;
			padding-top: 34rpx;
			padding-bottom: 28rpx;
			margin-top: 40rpx;
			position: relative;

			.building-header {
				width: 100%;
				display: flex;
				align-items: center;
				justify-content: space-between;

				.building-header-left {
					font-size: 28rpx;
					font-weight: 700;
					color: #333333;
					line-height: 28rpx;
					display: flex;
					align-items: center;

					.line {
						width: 6rpx;
						height: 28rpx;
						background: #3d9c36;
						margin-right: 20rpx;
					}
				}

				.building-header-right {
					font-size: 24rpx;
					font-weight: 500;
					color: #333333;
					line-height: 24rpx;
				}

				.building-header-right::after {
					content: ">";
					margin-left: 10rpx;
					margin-right: 45rpx;
				}
			}
		}

		.float-image {
			position: fixed;
			z-index: 333;
			bottom: 77rpx;
			right: 20rpx;

			.float-image-consult {
				width: 182rpx;
				height: 221rpx;
			}
		}
	}
</style>